/*
 *  AppCompositor.h
 *  openFrameworks
 *
 *  Created by fregment on 08.06.09.
 *  Copyright 2009 __MyCompanyName__. All rights reserved.
 *
 */



#ifndef __APP_COMPOSITOR
#define __APP_COMPOSITOR

#include "ofAppCocoaWindow.h"

#include "ofMain.h"

#include <vector>
#include "ComposerVP.h"
#include "abliefern/Databaser.h"
#include "abliefern/XMPmediator.h"
#include "abliefern/MouseRecorder.h"
#include "ofxXmlSettings.h"
#include <time.h>


#define 	RANDOM 		1
#define 	MANUAL 		2
#define 	ERASE 		3



using namespace abliefern ;
	


class AppCompositor : public ofBaseApp{
	
public:
	
	void setup();
	void update();
	void draw();
	
	void keyPressed  (int key);
	void keyReleased(int key);
	void mouseMoved(int x, int y );
	void mouseDragged(int x, int y, int button);
	void mousePressed(int x, int y, int button);
	void mouseReleased(int x, int y, int button);
	void windowResized(int w, int h);
	
	
	void interfaceEvent(int theEvent, int theValue);
	void setKeywords(std::vector<std::string>* theKeywords);
	
	
	void doCreate();
	void drawPreview();
	void updatePreview();
	
	
	
	void saveFrame();
	
	void saveXML();
	void loadXML();

	
	
	
	
	
	std::vector<std::string> _InterfaceKeywords;
	
	
	
	
private:
	
	
	abliefern::MouseRecorder _myMouseRecorder;
	
	abliefern::XMPmediator _myXMPmediator;
	
	abliefern::Databaser _myDatabaser;
	
	float _myScale;
	
	std::string _mySegmentDirectory;
	std::string _myCompositionDirectory;
	std::string _myPreviewDirectory;
	
	bool _myFirstRun;
	bool _myPreviewMode;
	bool _showGrid;
	
	bool _useKeywords;
	
	
	bool _myMousePressed;
	bool _myVKeyPressed;
	bool _mySKeyPressed;
	
	bool _myFullscreenMode;
	
	bool _myRecycleSegment;
	bool _myIgnorePoints;
	
	bool _myRecordMode;
	bool _myMousePlayback;
	
	
	
	int _gridSize;
	int _gridDistance;
	
	int _myPointMode;
	int _myOverPoint;
	
	int _myMouseX;
	int _myMouseY;
	
	int _mySaveImageCounter;
	
	
	
	float _myPreviewSegmentScaleFactor;
	float _myTolerance;
	
	float _myBorderPercentageMax;
	float _myBorderPercentageMin;
	
	ofxXmlSettings _myXMLSettings;
	
	std::vector<std::string> _myKeywords;
	
	
	std::vector<ComposerVP> _myComposerVPs;
		
		
	std::vector<int> _myUsedSegments;
	
	std::vector<abliefern::ImageSegment> _myPreviewSegments;
	

	
	
	
	
	
	
	
		
	
	
	
};

#endif